[mirrors]
http://ftp.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20140325.tar.xz

[main]
filesize=278816
sha512=6645740d61da78845facce6e3881c64f51e945a454cb26cead6e7df4887f1f3797bea217cebaffaae22a76fa3867ee20dee7b1d5200df20b85878a0c6029c2f8
tardir=ca-certificates

[deps]
openssl

[build]
mkdir -p "$butch_install_dir""$butch_prefix"/share/ca-certificates/mozilla
patch -p1 < "$K"/ca-certificates.patch || exit 1
cp "$K"/certdata2pem.c mozilla/
cat << EOF > mozilla/Makefile
all: a.out
	./a.out
a.out:
	\$(HOSTCC) -Wall -Wextra -O0 -g certdata2pem.c
clean:
	-rm -f *.crt
install:
	for p in *.crt; do \
	 install -D -m 644 \$\$p \$(CERTSDIR)/\$\$p ; \
	done
EOF
make || exit 1
make DESTDIR="$butch_install_dir" install || exit 1

mkdir -p "$butch_install_dir/etc/ssl/certs" || exit 1

( cd "$butch_install_dir/share/ca-certificates/"
  find . -name '*.crt' | sort | cut -b3- > "$butch_install_dir/etc/ca-certificates.conf" )

cp sbin/update-ca-certificates . || exit 1
sed -e 's#=/etc/#=${DESTDIR}/etc/#' -i update-ca-certificates
sed -e 's#=/share/#=${DESTDIR}/share/#' -i update-ca-certificates
sed -e 's#=/local/#=${DESTDIR}/local/#' -i update-ca-certificates

DESTDIR="$butch_install_dir" sh ./update-ca-certificates --fresh || exit 1

